<template>
  <chart :auto-resize="true" :options="options"> </chart>
</template>

<script>
import { graphic } from "echarts/lib/export";
export default {
  props: ["title", "color"],
  data() {
    return {
      options: {
        tooltip: {
          trigger: "axis",
        },
        grid: {
          top: 28,
          left: 10,
          right: 15,
          bottom: 20,
          containLabel: true,
        },
        xAxis: {
          type: "category",
          boundaryGap: true,
          data: ["12.08", "12.09", "12.10", "12.11", "12.12", "12.13", "12.14"],
          axisLine: {
            //y轴
            show: false,
          },
          axisTick: {
            //y轴刻度线
            show: false,
          },
          axisLabel: {
            show: true,
            textStyle: {
              color: "#48EAFF",
              fontSize: 12,
            },
          },
        },
        yAxis: {
          type: "value",
          name: this.title,
          nameTextStyle: {
            color: "#fff",
            fontSize: 12,
            padding: [0, 0, 0, -15], // 四个数字分别为上右
          },

          scale: true,
          axisLine: {
            //y轴
            show: false,
          },
          axisTick: {
            //y轴刻度线
            show: false,
          },
          splitLine: {
            //网格线
            show: false,
          },
          axisLabel: {
            show: true,
            textStyle: {
              color: "#48EAFF",
              fontSize: 12,
            },
          },
        },
        series: [
          {
            type: "line",
            showSymbol: true,
            symbol: "circle", //设定为实心点
            symbolSize: 10, //设定实心点的大小
            itemStyle: {
              normal: {
                color: "#4FFFFC", //改变折线点的颜色
                lineStyle: {
                  color: "#077D8C", //改变折线颜色
                },
              },
            },

            markLine: {
              silent: false,
              symbol: ["none", "none"], //去掉箭头
              data: [
                {
                  yAxis: 1,
                  lineStyle: {
                    color: "#077D8C",
                  },
                },
                {
                  yAxis: 0.2,
                  lineStyle: {
                    color: "#077D8C",
                  },
                },
              ],
            },
            areaStyle: {
              normal: {
                color: new graphic.LinearGradient(0, 0, 0, 1, [
                  { offset: 0, color: this.color },
                  { offset: 1, color: "rgba(38,197,254,0.00)" },
                ]),
              },
            },
            data: [0.3, 0.5, 0.45, 0.7, 0.7, 0.75, 1.1],
          },
        ],
      },
    };
  },
};
</script>
